package com.easylinkin.linkappapi.ruleengine.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 智能规则引擎
 * </p>
 *
 * @author TongJie
 * @since 2020-08-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("rule_engine")
@ApiModel("规则引擎实体类")
public class RuleEngine extends Model<RuleEngine> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId("id")
    @ApiModelProperty(value = "主键ID", example = "")
    private String id;

    /**
     * 规则名称
     */
    @TableField("name")
    @ApiModelProperty(value = "规则名称", example = "")
    private String name;

    /**
     * 状态 0-停用 1-启用
     */
    @TableField("status")
    @ApiModelProperty(value = "状态", example = "1")
    private Integer status;

    /**
     * 空间id
     */
    @TableField("space_id")
    @ApiModelProperty(value = "空间ID", example = "")
    private String spaceId;

    /**
     * 区域id
     */
    @TableField("area_id")
    @ApiModelProperty(value = "区域id", example = "")
    private String areaId;

    /**
     * 区域名称
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "区域名称", example = "")
    private String areaName;


    /**
     * 租户id
     */
    @TableField("tenant_id")
    @ApiModelProperty(value = "租户id", example = "")
    private String tenantId;

    /**
     * 规则描述说明
     */
    @TableField(value = "description", strategy = FieldStrategy.IGNORED)
    @ApiModelProperty(value = "/**", example = "")
    private String description;

    /**
     * 创建时间
     */
    @TableField("create_time")
    @ApiModelProperty(value = "创建时间", example = "")
    private Date createTime;

    /**
     * 修改时间
     */
    @TableField("modify_time")
    @ApiModelProperty(value = "修改时间", example = "")
    private Date modifyTime;

    /**
     * 创建人id
     */
    @TableField("creator")
    @ApiModelProperty(value = "创建人id", example = "")
    private String creator;

    /**
     * 修改人id
     */
    @TableField("modifier")
    @ApiModelProperty(value = "修改人id", example = "")
    private String modifier;

    /**
     * 可自动恢复的
     */
    @TableField("auto_recoverable")
    @ApiModelProperty(value = "可自动恢复的", example = "")
    private Boolean autoRecoverable;

    /**
     * 触发器
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "触发器", example = "")
    private List<RuleTrigger> ruleTriggers;
    /**
     * 条件器
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "条件器", example = "")
    private List<RuleCondition> ruleConditions;
    /**
     * 执行器
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "执行器", example = "")
    private List<RuleExecution> ruleExecutions;

    @TableField(exist = false)
    @ApiModelProperty(value = "", example = "")
    private List<String> ids;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
